package com.xls.box2023.adapter;


import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.lzz.bottomencapsulation.holder.MvpRVViewHolder;
import com.xls.box2023.R;
import com.xls.box2023.entity.JiFenDuiHuanJiLuEntity;

public class JiFenDuiHuanJiLuViewHolder  extends MvpRVViewHolder<JiFenDuiHuanJiLuEntity> {
    private TextView duihuanjilu_time;
    private TextView duihuanjilu_title_1;
    private TextView duihuanjilu_jibi_num;
    private TextView duihuanjilu_title_2;
    private TextView duihuanjilu_xiaohaodejifen;
    private TextView duihuanjilu_title_3;
    private TextView duihuanjilu_jianglidejifen;
    private ImageView duihuanjilu_zhuangtai;
    String type;
    public JiFenDuiHuanJiLuViewHolder(Context context, ViewGroup p,String type) {
        super(R.layout.item_jifenduihuanjilu, context, p);
        this.type=type;
    }

    @Override
    public void initView() {

        duihuanjilu_time = itemView.findViewById(R.id.duihuanjilu_time);
        duihuanjilu_title_1 = itemView.findViewById(R.id.duihuanjilu_title_1);
        duihuanjilu_jibi_num = itemView.findViewById(R.id.duihuanjilu_jibi_num);
        duihuanjilu_title_2 = itemView.findViewById(R.id.duihuanjilu_title_2);
        duihuanjilu_xiaohaodejifen = itemView.findViewById(R.id.duihuanjilu_xiaohaodejifen);
        duihuanjilu_title_3=itemView.findViewById(R.id.duihuanjilu_title_3);
        duihuanjilu_jianglidejifen=itemView.findViewById(R.id.duihuanjilu_jianglidejifen);
        duihuanjilu_time.setText(viewData.getCreateTime());
        duihuanjilu_jibi_num.setText(viewData.getCoins()+" 金币");
        if (!TextUtils.isEmpty(viewData.getScore())){
            duihuanjilu_xiaohaodejifen.setText(viewData.getScoreStr()+" 元宝");
        }
//&&TextUtils.equals(type, StateConsts.TiXianType.ShouYi)
        if (!TextUtils.isEmpty(viewData.getSubsidyScore())){
            duihuanjilu_title_3.setVisibility(View.VISIBLE);
            duihuanjilu_jianglidejifen.setVisibility(View.VISIBLE);
            duihuanjilu_jianglidejifen.setText(viewData.getSubsidyScoreStr()+" 元宝");
        }else {
            duihuanjilu_title_3.setVisibility(View.GONE);
            duihuanjilu_jianglidejifen.setVisibility(View.GONE);
        }

        duihuanjilu_zhuangtai = itemView.findViewById(R.id.duihuanjilu_zhuangtai);

        if (viewData.getStatus()==0){
            duihuanjilu_zhuangtai.setImageResource(com.xls.resource.R.drawable.ic_state_jifen_duihuan0);
        }else if (viewData.getStatus()==1){
            duihuanjilu_zhuangtai.setImageResource(com.xls.resource.R.drawable.ic_state_jifen_duihuan1);
        }else{
            duihuanjilu_zhuangtai.setImageResource(com.xls.resource.R.drawable.ic_state_jifen_duihuan3);
        }

    }
}
